<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>v-bind实例</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
    <style>
        .classA{
            color: red;
        }
        .classB{
            font-size: 150%;
        }
    </style>
</head>
<body>
<h1>v-bind属性绑定实例</h1>
<hr>
<div id="app">
    <p><img v-bind:src="imgSrc" width="200px"></p>
    <p><a v-bind:href="webUrl" target="_blank">百度</a></p>
    <hr>
    <p><a :class="className">1、绑定class</a></p>
    <p><a :class="[classA,classB]">2、绑定class数组</a></p>
    <p><a :class="{classA:isOk}">3、判断是否使用class</a></p>
    <input type="checkbox" id="isOk" v-model="isOk">
    <label for="isOk">isOk={{isOk}}</label>
    <p><a :class="isOk?classA:classB">4、三元运算符</a></p>
    <p><a :style="{color:red,fontSize:font}">5、绑定style</a></p>
    <p><a :style="styleObject">5、绑定style对象</a></p>
</div>
<script type="text/javascript">
    var app = new Vue({
      el:'#app',
      data:{
        imgSrc:'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png',
        webUrl:'http://jspang.com/2017/02/23/vue2_01/#5v-on',
        className:'classA',
        classA:'classA',
        classB:'classB',
        isOk:true,
        red:'blue',
        font:'20px',
        styleObject:{
          color:'green',
          fontSize:'24px'
        }
      }
    })
</script>
</body>
</html>